from celery import Celery
import time
# 消息中间件
# backend = 'redis://:123456@127.0.0.1:6379/1'
backend = 'redis://127.0.0.1:6379/2'
# 结果存储
broker = 'redis://127.0.0.1:6379/1'

app = Celery('test', broker=broker, backend=backend)


# 写任务
@app.task
def add(a, b):
    time.sleep(1)
    return a + b
